home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / ultqsrc.zip / HOLO2.QC < prev    next >
Text File  |  1996-10-01  |  8KB  |  226 lines

  1. void() holo_stand1; // = [12, holo_stand2] {};
  2.  
  3. void(entity me, entity camera) HoloView =
  4. {
  5.   // Set view point
  6.   msg_entity = me;                         // target of message
  7.   WriteByte (MSG_ONE, SVC_SETVIEWPORT);    // 5 = SVC_SETVIEWPORT;  
  8.   WriteEntity (MSG_ONE, camera);           // view port
  9.   // Also set angles, otherwise it feels strange
  10.   // NezuSetViewAngle(me, camera.angles);
  11.   WriteByte (MSG_ONE, SVC_SETVIEWANGLES);  // 10 = SVC_SETVIEWANGLES
  12.   WriteAngle(MSG_ONE, camera.angles_x);    // tilt 
  13.   WriteAngle(MSG_ONE, camera.angles_y);    // yaw
  14.   WriteAngle(MSG_ONE, camera.angles_z);    // flip
  15. };
  16.  
  17. void(entity me) HoloCam = 
  18. {
  19.   local entity camera, viewpoint;
  20.   local    vector me_src;
  21.   local vector me_targ;
  22.   local vector me_fire;
  23.  
  24.   if (me.newholo.active)
  25.         viewpoint = me.newholo;
  26.   else if (me.teleeyes.active)
  27.         viewpoint = me.teleeyes;
  28.   else
  29.         {
  30.         sound (self, CHAN_WEAPON, "doors/basetry.wav", 1 , ATTN_NORM);
  31.         sprint (self,"Neither Holograph or TeleEyes are Active!\n");
  32.         return;
  33.         }
  34.  
  35.  
  36.   if(me.aflag!=0)                // camera is on, set it off
  37.   { 
  38.     camera=me;
  39.     HoloView(me, me);      // restore player position
  40.     sprint(me,"Remote Camera off\n");
  41.     me.aflag=0;                  // camera is ready
  42.     //do not change me.trigger_field  for the NezuCameraCycle
  43.   }
  44.   else                             // camera is off, try to set it on
  45.   {
  46.     HoloView(me, viewpoint);       // Restore player position
  47.     sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  48.     sprint(me,"Remote Camera on!\n");      // Message for player
  49.     me.aflag=666;                       // Camera is on
  50.   }
  51. };
  52.  
  53. void() DetHolo =
  54. {
  55.     local float    damg;
  56.  
  57.         if (self.teleeyes.active)
  58.                 {
  59.                 if (self.aflag == 666)
  60.                         HoloCam (self);
  61.                 remove (self.teleeyes);
  62.                 sprint (self,"TeleEyes Deactivated\n");
  63.                 self.teleeyes.active = FALSE;
  64.                 return;
  65.                 }
  66.  
  67.         if (self.newholo.active == FALSE)
  68.                 {
  69.                 sound (self, CHAN_WEAPON, "doors/basetry.wav", 1 , ATTN_NORM);
  70.                 sprint (self,"Neither Holograph nor TeleEyes are Active!\n");
  71.                 return;
  72.                 }
  73.  
  74.         if (self.mana < 10)
  75.                 {
  76.                 sound (self, CHAN_WEAPON, "doors/basetry.wav", 1 , ATTN_NORM);
  77.                 sprint (self, "Not enough mana to detonate Holo\n");
  78.                 return;
  79.                 }
  80.  
  81.         if (self.aflag == 666)
  82.                 HoloCam (self);
  83.  
  84.     damg = 100 + random()*20;
  85.     
  86.         self.mana = rint(time - self.init_mana);
  87.         if (self.mana > self.exp)
  88.                 self.mana = self.exp;
  89.         self.init_mana = time - self.mana + 10;
  90.  
  91.         T_RadiusDamage (self.newholo, self, 300, self.newholo);
  92.  
  93.         sound (self.newholo, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  94.         self.newholo.origin = self.newholo.origin - 8*normalize(self.newholo.velocity);
  95.  
  96.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  97.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  98.         WriteCoord (MSG_BROADCAST, self.newholo.origin_x);
  99.         WriteCoord (MSG_BROADCAST, self.newholo.origin_y);
  100.         WriteCoord (MSG_BROADCAST, self.newholo.origin_z);
  101.  
  102.         sprint(self,"Holograph Detonated\n");
  103.         self.newholo.active = FALSE;
  104.         remove (self.newholo);
  105. };
  106.  
  107. //--------------------------------------------------------------------
  108. // When time expires holograph gets deactivated
  109. //--------------------------------------------------------------------
  110. void(entity actor) RemoveHolo =
  111. {
  112.         if (actor.owner.aflag == 666)
  113.                 HoloCam (actor.owner);
  114.  
  115.         if (actor.owner.mana < 0)
  116.                 actor.owner.mana = 0;
  117.  
  118.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  119.     WriteByte (MSG_BROADCAST, TE_TELEPORT);
  120.         WriteCoord (MSG_BROADCAST, actor.origin_x);
  121.         WriteCoord (MSG_BROADCAST, actor.origin_y);
  122.         WriteCoord (MSG_BROADCAST, actor.origin_z);
  123.         sound (actor, CHAN_BODY, "misc/r_tele1.wav", 1, ATTN_NORM);
  124.         actor.active = FALSE;
  125.         actor.feigning = FALSE;
  126.         actor.isfeign = FALSE;
  127.         sprint(actor.owner,"Holograph Removed\n");
  128.         remove(actor);
  129. };
  130.  
  131. //--------------------------------------------------------------------
  132. // Frames for holograph self
  133. //--------------------------------------------------------------------
  134.  
  135. //--------------------------------------------------------------------
  136. // Spawns holograph self
  137. //--------------------------------------------------------------------
  138. void(entity myself) ActivateHolo =
  139. {
  140. local entity hol;
  141.         hol = spawn();
  142.         hol.solid = SOLID_BBOX;
  143.         hol.takedamage = DAMAGE_AIM;
  144.         hol.health = 99999999;
  145.         hol.movetype = MOVETYPE_NOCLIP;
  146.         hol.origin = myself.origin;
  147.         hol.angles = myself.angles;
  148.         setsize (hol, VEC_HULL_MIN, VEC_HULL_MAX);
  149.         hol.colormap = myself.colormap;
  150.         hol.skin = myself.skin;
  151.         setmodel (hol, "progs/player.mdl");
  152.         hol.classname = "holo";
  153.         hol.owner=myself;
  154.         myself.newholo = hol;
  155.         stuffcmd (hol.owner, "bf\n");
  156.         sprint(hol.owner,"Holograph activated\n");
  157.         hol.nextthink = time; 
  158.         hol.think = holo_stand1;    
  159.         hol.active = TRUE;
  160.         hol.th_stand = SUB_Null;
  161.         hol.th_walk = SUB_Null;
  162.         hol.th_run = SUB_Null;
  163.         hol.th_pain = SUB_Null;
  164.         hol.th_melee = SUB_Null;
  165.         hol.th_missile = SUB_Null;
  166.         hol.th_die = GrenadeExplode;
  167.         hol.beendead = TRUE;
  168. };
  169.  
  170.  
  171.  
  172. //--------------------------------------------------------------------
  173. // Checks if holograph should be activated
  174. //--------------------------------------------------------------------
  175. void() CheckHoloCommand = 
  176. {
  177.         if (self.newholo.active == TRUE)
  178.                 {
  179.                 sprint (self,"Deactivating Holograph\n");
  180.                 RemoveHolo(self.newholo);
  181.                 return;
  182.                 }
  183.         if (self.mana < 10)
  184.     {
  185.                 sound (self, CHAN_WEAPON, "doors/basetry.wav", 1 , ATTN_NORM);
  186.                 sprint(self,"Mana is too low!\n");
  187.         return;
  188.     }
  189.         if (self.teleeyes.active)
  190.         {
  191.                 sound (self, CHAN_WEAPON, "doors/basetry.wav", 1 , ATTN_NORM);
  192.                 sprint(self,"Deactivate your Tele-Eyes first!\n");
  193.                 return;
  194.         }
  195.     ActivateHolo (self);
  196. }; 
  197.  
  198. void(entity actor) feign =
  199. {
  200.         if (!actor.isfeign)              // If not already, feign death
  201.         {
  202.                 actor.view_ofs = '0 0 2';
  203.                 if (self.enemy.classname == "player")
  204.                         self.enemy.frags = self.enemy.frags + 1;
  205.                 else
  206.                         self.frags = self.frags - 1;
  207.                 actor.isfeign = TRUE;
  208.                 if(actor.classname=="holo")
  209.                         sprint (self, "Holograph feigning death...\n");
  210.                 else{actor.movetype = MOVETYPE_TOSS;setsize (actor , '-16 -16 -4' , '16 16 4');self.impulse=20;DropBackpack();player_diea1();}
  211.         }
  212.         else                    // otherwise, get up
  213.         {
  214.                 setsize (actor, VEC_HULL_MIN, VEC_HULL_MAX);
  215.                 actor.view_ofs = '0 0 22';
  216.                 if (self.enemy.classname == "player")
  217.                         self.enemy.frags = self.enemy.frags - 1;
  218.                 else
  219.                         self.frags = self.frags + 1;
  220.         actor.isfeign = FALSE;
  221.         if(actor.classname=="holo")
  222.                 sprint (self, "Holograph has stopped fiegning...\n");
  223.         else{actor.movetype = MOVETYPE_WALK;holo_upa1();}
  224.         }
  225. };
  226.